#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    // cout << "bug!!!!!!!!!!!!!" << endl;
    int n;
    cin >> n;
    vector<int> a(n);
    bool f[2] = {0};
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] % 2 == 1)
            f[0] = 1;
        if (a[i] % 2 == 0)
            f[1] = 1;
    }
    if (f[0] && f[1])
    {
        sort(a.begin(), a.end());
        for (auto &e : a)
        {
            cout << e << " ";
        }
        cout << "\n";
    }
    else
    {

        for (auto &e : a)
        {
            cout << e << " ";
        }
        cout << "\n";
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}